﻿@{
    Layout = "../Shared/_InnerPage.cshtml";
}
@model XoohooViewModelItem<UserGroupInput>
@section TitleContent{
    @Html.SiteTitle("系统管理", "用户管理", "用户组管理", "用户组编辑")
}
@section NavigationContent
{
    当前位置：用户管理 &gt;&gt; 用户组管理 &gt;&gt; 用户组编辑
}
@{
    UserGroupInput userGroupInput = Model.Item;
    SelectList userGroups = Model.GetModelItem<SelectList>("UserGroups");
    var roles = Model.GetModelItem<IEnumerable<RoleBasic>>("Roles");
    Html.BeginRouteForm("Admin.Membership.User.UserGroupSave", FormMethod.Post, new { @id = "UserGroupEditForm", @name = "UserGroupEditForm" });
}
    <table cellpadding="4" cellspacing="0" class="tbl">
        <tr>
            <td class="tit">
                所属用户组：
            </td>
            <td>
                @Html.DropDownListFor(userGroupInput,item=>item.ParentID, userGroups,"-请选择-")
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td class="tit">
                用户组名称：
            </td>
            <td class="con">
                @Html.TextBoxFor(userGroupInput,item=>item.UserGroupName, new { @class = "input" })
            </td>
            <td>
                @Html.ValidationMessageFor(userGroupInput, item => item.UserGroupName, "请输入用户组名称")
            </td>
        </tr>
        <tr>
            <td class="tit">
                包含角色：
            </td>
            <td class="con">
            @{
              if(!roles.IsNullOrEmpty())  
              {
                      var isChecked = false;
                      foreach (var r in roles)
                      {
                          isChecked = userGroupInput != null && userGroupInput.Roles != null && userGroupInput.Roles.Any(v => v == r.RoleID);
                          WriteLiteral("{0}&nbsp;{1}<br/>".FormatWith(Html.CheckBox("Roles", r.RoleID.ToString(), isChecked), r.RoleName));
                      }
              }
              }
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td class="tit">
            </td>
            <td>
                @Html.ImageButton("btnSubmit", "btnSubmit", "Styles/Images/btnSubmit.jpg")
            </td>
            <td>
            </td>
        </tr>
    </table>@{Html.EndForm();}
